home *** CD-ROM | disk | FTP | other *** search
- > Instead of adressing a structure in 68030, I think I would take less machine time
- > adressing each array lonely. I explain :
-
- I beg to differ, but we'll get to that.
-
- > with a structure array like :
- ...
- > To use code like a[1], then a[2], then a[3], you must increase your register
- > pointer An before a read.
-
- Yes.
-
- > If I code
- > short a[40]
- > short b[40] , and so on, I can put a register = first value of the array,
- > then I use (an)+ mode. With that, code can improve a lot when there are lots
- > of structure manipulations. I don't know if it speeds c code a lot, coz I'm not
- > sure a c compiler use (An)+ options.
-
- C compilers (at least the good ones) use those addressing modes when they
- can. They never break structures apart, though, and there are good reasons
- for that.
-
- > If you don't understand what I try to explain, don't worry, keep the structures,
- > I'll adapt for 68030. Anyway, I'll break all the structures.
-
- Please, don't do that. Apart from making the assembly parts impossible to
- use together with the C parts, it'll also cause slow down in most places.
-
- On processors with data caches like the '030 it's a good idea to keep
- frequently used data close together, since the cache is usually filled in
- bursts of 16 bytes (or something like that). In the case of an array of
- a structure, that means that a complete structure element is often loaded
- at once. Since you often access several of the individual elements in the
- structure element the processor won't need to go out and fetch anything
- else from memory. If the individual elements were in different places a
- simple thing like:
- if ((my_array[i].x > my_array[i].y) && (my_array[i].top == my_array[i].bot))
- would end up loading _64_ bytes from memory. If the structure was kept
- together only a single cache line (16 bytes) would have to be read.
-
- _If_ there are lots of sequential accesses to a structure it might be
- a good idea to do as you suggest, but in DVIEW there are very few of
- those (for the structures loaded from the WAD that is).
-
- Let me know if you disagree with this. Apart from the reasons above, the
- future plans of moving this onto the DSP would probably also make it
- necessary to put the structures back together since that chip has far
- too few address registers to waste.
-
- > Does it mean that also it's not used, except for player start pos, I must code it ?
- > I think it might give the monsters and objects positions in the game, but I may be
- > wrong. Correct me if I'm wrong.
-
- Yes, I believe monsters, weapons, medikits etc etc are in there, so it's
- definitely needed.
-
- > > I still don't like your name for it, though.
- >
- > So, I'll call it the 'don't cross this wall' function :-)
-
- That's better. When I've written it we won't have to call it anything
- anymore, which is even better. ;-)
-
-
- By the way, why did you convert the WAD load routines to assembler?
- 10 lines of assembler could've got 99% of the speed with _much_ less work.
- Then there's the question of whether there's any point in optimizing
- a routine that's used at most once every fifteen minutes or so.
- C is also very good at taking care of the ARGV stuff.
-
- --
- Chalmers University | Why are these | e-mail: d8klojo@dtek.chalmers.se
- of Technology | .signatures | rand@cd.chalmers.se
- | so hard to do | www/ftp: rand.thn.htu.se
- Gothenburg, Sweden | well? | (MGIFv5 and QLem)
-
-